﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dpdw.Behaviour.OberverPattern
{
    public class CurrentConditionsDisplay : Observer
    {
        private Subject weatherData;

        private float temperature;
        private float humidity;
        private float pressure;

        public CurrentConditionsDisplay(Subject weatherData)
        {
            this.weatherData = weatherData;
            this.weatherData.RegisterObserver(this);
        }

        public void Update(float temperature, float humidity, float pressure)
        {
            this.temperature = temperature;
            this.humidity = humidity;
            this.pressure = pressure;

            Display();
        }

        public void Display()
        {
            System.Diagnostics.Trace.WriteLine(
                "temperature = " + this.temperature +
                "humidity = " + this.humidity +
                "pressure = " + this.pressure
                );
        }
    }
}
